From 075661d376333a25b7fb622e1da2f02e347c0b6a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 4 Aug 2010 18:43:53 -0400 Subject: [PATCH] generic damage generation for offscreen windows Generating damage from gdk drawing api doesn't help for cairo rendering ...and the gdk drawing api is gone anyway. Bug 621571 --- gdk/gdkoffscreenwindow.c | 39 --------------------------------------- gdk/gdkwindow.c | 4 ++++ 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index c8fc4187ae..2c808083e6 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -209,45 +209,6 @@ gdk_offscreen_window_get_visual (GdkDrawable *drawable) return gdk_drawable_get_visual (offscreen->wrapper); } -static void -add_damage (GdkOffscreenWindow *offscreen, - int x, int y, - int w, int h, - gboolean is_line) -{ - GdkRectangle rect; - cairo_region_t *damage; - - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - - if (is_line) - { - /* This should really take into account line width, line - * joins (and miter) and line caps. But these are hard - * to compute, rarely used and generally a pain. And in - * the end a snug damage rectangle is not that important - * as multiple damages are generally created anyway. - * - * So, we just add some padding around the rect. - * We use a padding of 3 pixels, plus an extra row - * below and on the right for the normal line size. I.E. - * line from (0,0) to (2,0) gets h=0 but is really - * at least one pixel tall. - */ - rect.x -= 3; - rect.y -= 3; - rect.width += 7; - rect.height += 7; - } - - damage = cairo_region_create_rectangle (&rect); - _gdk_window_add_damage (offscreen->wrapper, damage); - cairo_region_destroy (damage); -} - void _gdk_offscreen_window_new (GdkWindow *window, GdkScreen *screen, diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index f39d2ca35e..81f3ab331b 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -4305,6 +4305,10 @@ _gdk_window_process_updates_recurse (GdkWindow *window, if (cairo_region_is_empty (expose_region)) return; + if (gdk_window_is_offscreen (private->impl_window) && + private == private->impl_window) + _gdk_window_add_damage ((GdkWindow *) private->impl_window, expose_region); + /* Make this reentrancy safe for expose handlers freeing windows */ children = g_list_copy (private->children); g_list_foreach (children, (GFunc)g_object_ref, NULL); -- 2.30.2